package zlatan_demo09_map

import scala.collection.mutable

object ClassDemo03 {
  def main(args: Array[String]): Unit = {
    val map1 = mutable.Map("张三" -> 23, "李四" -> 24)
    println(s"张三的年龄：${map1("张三")}")
    println("*" * 20)
    for ((i, j) <- map1) println(i, j)
    println("*" * 20)

    println(map1.getOrElse("王五", -1))
    println("*" * 20)

    map1 += "王五" -> 25
    println(map1)

    println("*" * 20)
    //映射中根据键即可找到相应的值，删除时只需指明删除的键即可
    map1 -= "王五"
    println(map1)
  }

}
